package day002.homework;

import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字:");
        int num = sc.nextInt();
        int res = 0;
        while (num != 0) {
            int temp = num % 10;
            num /= 10;
            res += temp;
        }

        System.out.println("结果为：" + res);
    }
}
